

export class EquipmentItemNeedModel {
    Str: number
    Con: number
    Will: number
    constructor(opts: any = {}) {
        this.Str = opts.Str || 0
        this.Con = opts.Con || 0
        this.Will = opts.Will || 0
    }
}

export class EquipmentItemModel {
    lvl: number
    fixedAttri: any[]//固定属性
    mainAttris: any[]//主属性名称 属性值
    subAttris: any[]//随机属性名称 属性值
    quality: number//物品品质 1普通 2优秀 3卓越 4完美 5史诗
    strengthen: number
    gems: ItemModel[]
    //下面是类的构造函数,参数给类的实例赋值属性
    constructor(opts: any = {}) {
        this.lvl = opts.lvl || 1
        this.fixedAttri = opts.fixedAttri || []
        this.mainAttris = opts.mainAttris || []
        this.subAttris = opts.subAttris || []
        this.quality = opts.quality || 0
        this.strengthen = opts.strengthen || 0
        this.gems = opts.gems || [null, null]
    }
}

export class ItemModel {
    tID: number
    lvl: number//物品等级
    // name: string//物品名称
    // infor: string //物品介绍
    stack: number//堆叠数量
    pos: number//所在位置
    hp: number//持久度
    new: number//是否新获得
    lock: number//物品锁
    price: number
    kind: string
    equipment: EquipmentItemModel
    treasure: TreasureItemModel
    constructor(opts: any = {}) {
        this.tID = opts.tID || 0
        this.lvl = opts.lvl || 0
        // this.name = opts.name || ''
        // this.infor = opts.infor || ''
        this.stack = opts.stack || 0
        this.pos = opts.pos || 0
        this.hp = opts.hp || 0
        this.new = opts.new || 0
        this.lock = opts.lock || 0
        this.price = opts.price || 0
        this.kind = opts.kind || ''
        this.equipment = opts.equipment ? new EquipmentItemModel(opts.equipment) : null
        this.treasure = opts.treasure ? new TreasureItemModel(opts.treasure) : null
    }
}



export class TreasureItemModel {
    lvl: number
    attris: any[]//属性名称 属性值
    quality: number//物品品质 1普通 2优秀 3卓越 4完美 5史诗
    strengthen: number
    exp: number
    rand: number
    upLvl: number
    //下面是类的构造函数,参数给类的实例赋值属性
    constructor(opts: any = {}) {
        this.lvl = opts.lvl || 1
        this.attris = opts.attris || []
        this.quality = opts.quality || 0
        this.strengthen = opts.strengthen || 0
        this.exp = opts.exp || 0
        this.rand = opts.rand || 100
        this.upLvl = opts.upLvl || 0
    }
}
